#include "Server.hpp"
#include "Log.hpp"
#include "Command.hpp"

int main(int argc,char* argv[])
{
    if(argc != 2)
    {
        LOG(ERROR,"./tcpserver serverport\n");
        exit(2);
    }

    uint16_t localport = std::stoi(argv[1]);
    Command cmd;
    task_t t = std::bind(&Command::Handler,&cmd,std::placeholders::_1,std::placeholders::_2);
    std::unique_ptr<TcpServer> server = std::make_unique<TcpServer>(t,localport);
    server->Init();
    server->Loop();

    return 0;
}